/**
 * EMF.java
 * Jan 11, 2010
 */
package com.dlplay.flightinfo.db.datastore;

/**
 * @author zhao yu
 *
 */
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public final class EMF {
    private static final EntityManagerFactory emfInstance =
        Persistence.createEntityManagerFactory("transactions-optional");

    private EMF() {}

    public static EntityManagerFactory get() {
        return emfInstance;
    }
    
    public static EntityManager getEntityManager() {
    	if (emfInstance != null)
    		return emfInstance.createEntityManager();
    	return null;
    }
}
